<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ManagerManager for Modx: Getting started</title>
<link href="css/mm.css" rel="stylesheet" type="text/css" />


</head>

<body>

<div id="banner">

</div>


<div id="main">
    <div id="nav">
        <ul>
            <li><a href="index.htm">Introduction</a></li>
            <li><a href="install.htm">Installation</a></li>
            <li>Getting started</li>
            <li><a href="field-names.htm">Field names</a></li>
            <li><a href="fields.htm">Fields</a></li>
            <li><a href="tabs.htm">Tabs</a></li>
            <li><a href="widgets.htm">Widgets</a></li>
            <li><a href="sections.htm">Sections</a></li>
            <li><a href="changelog.htm">Changelog</a></li>
        </ul>   
    </div>
    
  <div id="content">
    <h1>How it works</h1>
    <p>MM works by creating a series of actions (or &quot;rules&quot;), which can be applied to particular fields. Each rule can be applied to certain roles, certain templates or any combination or either. </p>
    <p>For example, to rename a field for all templates and all users, you might use:</p>
    <code>mm_renameField('pagetitle', 'Document title');</code>
    <p>You could then restrict this only to users with a particular role by supplying a third parameter, which is an ID of one or more web user roles. You'll see a new tab when you're editing the plugin which tells you what these are.</p>
    <p>To restrict the example above to only admin role 1, you could add:</p>
    <p><code>mm_renameField('pagetitle', 'Document title', '1');</code></p>
    <p>You can supply more than one role, as a comma separated list:</p>
    <p><code>mm_renameField('pagetitle', 'Document title', '1,3,5');</code></p>
    <p>If you want to make a rule which is &quot;everything but&quot; you can do this by prefixing the list with a &quot;!&quot;. For example to apply a rule to everyone EXCEPT administrators, you could say:</p>
    <p><code>mm_renameField('pagetitle', 'Document title', '!1');</code></p>
    <p>Note: the exclaimation negates all the roles, you can't mix and match - for example:</p>
    <p><code>mm_renameField('pagetitle', 'Document title', '!2,3');</code></p>
    <p>Would apply the rule to users who are not in role 2 or 3.</p>
    <p>Finally, if you leave the roles paramater blank, or miss it off, the rule will apply to ALL roles.</p>
    <p>You can get further refinement to your rules, by restricting them to certain template IDs too. You can also supply template IDs using exactly the same format. For example:</p>
    <p><code>mm_renameField('pagetitle', 'Document title', '', '3');</code></p>
    <p>Will only apply the rule to documents with a template ID of 3.</p>
    <p><code>mm_renameField('pagetitle', 'Document title', '!1', '3');</code></p>
    <p>Will apply the rule to users who are not in role 1 when they edit a document with a templaye of 3.</p>
    <p>Phew -- pretty powerful stuff, eh?</p>
    <h3>Applying it</h3>
    <p>You set the rules within the plugin code in the manager. Within the default plugin text is an indication of where they should go, along with some examples. Note that you can use PHP variables here to make things more legible -- for example to store template IDs.</p>
    <p>&nbsp;</p>
  </div>
</div>
</body>
</html>
